<?php
require_once ("./commun/ouvre_base.php");

$recupere_age = "SELECT `birthdate`
FROM `diagnostic`
WHERE `index` =$session";
$resulat_recupere_age = mysql_query ( $recupere_age ) or die ( "impossible de remplir le questionnaire à partir de la table : " . mysql_error () );

$lignes = array ();
while ( $line = mysql_fetch_row ( $resulat_recupere_age ) ) {
	array_push ( $lignes, $line [0] );
}

$birthdate = $lignes [0];
$array_birthdate = explode ( '-', $birthdate );

$naiss = mktime ( 0, 0, 0, $array_birthdate [1], $array_birthdate [2], $array_birthdate [0] );
$today = mktime ();
$secondes = ($today > $naiss) ? $today - $naiss : $naiss - $today;

$age = date ( 'Y', $secondes ) - 1970;

// echo "Je suis né il y a $annees an" . ($annees>1?'s':null) . '.';

?>
